package com.fengyun.scala

/**
 * @author Hanpeng
 * @date 2021/1/24 19:45
 * @description: 这个类废弃了 不怎么用了 这个方法delayedInit 会先执行
 */
object TestDelayedInit extends App{
  val c = new C
}
trait Helper extends DelayedInit {
  def delayedInit(body: => Unit) = {
    println("dummy text, printed before initialization of C")
    body // evaluates the initialization code of C
  }
}

class C extends Helper {
  println("this is the initialization code of C")
}

